# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=smbsr
pkgver=50.7f86241
pkgrel=5
pkgdesc='Lookup for interesting stuff in SMB shares.'
groups=('blackarch' 'blackarch-scanner' 'blackarch-recon')
arch=('any')
url='https://github.com/oldboy21/SMBSR'
license=('Apache')
depends=('python' 'python-pysmb' 'python-python-masscan' 'python-textract'
         'python-ldap' 'python-tqdm' 'python-ldap3')
makedepends=('git')
source=("$pkgname::git+https://github.com/oldboy21/SMBSR.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md requirements.txt

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

